<?php
namespace app\api\controller\m2979\auto;

use app\approval\service\Step;
use app\member\model\Member;
use think\Db;
use service\ApiReturn;
use app\api\controller\Base;
use app\member\service\MemberCache;


class Freeinterface extends Base {
        /**
 *  查询接口
 *@create_time  2024-01-23 14:51:10
 */ 
public function get_interface($data = [], $user = [])
{
    $headLang  = request()->header('lang');
    $where = [];
  
    $order = 'freeorder.code desc';
	if (!empty($data['sort_field'])) {
		$order = 'freeinterface.'.$data['sort_field'].' '.$data['sort_type'];
	}

    $where[] = ['freeinterface.is_del', '=', 0]; 
 
    $select_info = array (
  'xingbie' => 
  array (
    1 => '男',
    2 => '女',
    3 => '保密',
  ),
); 
	$dataList = Db::table('lb_free_interface')
		->alias('freeinterface')
		->leftjoin('lb_free_order freeorder', 'freeorder.aid = freeinterface.freeorder_id')
		->field("freeorder.code as freeorder_code,freeinterface.shengri,freeinterface.xingbie,freeinterface.aihao")
		->where($where)
		->order($order)
		->group('freeorder.code')
		->select();
	foreach ($dataList as &$infodataList){
			$infodataList['shengri'] = $infodataList['shengri']? date('Y-m-d', $infodataList['shengri']) : '';
			$infodataList['xingbie_name'] = $select_info['xingbie']["{$infodataList['xingbie']}"] ?? '';
	}

    if($dataList){
        return ApiReturn::r(1, $dataList, '请求成功');
    }else{
        return ApiReturn::r(1, [], '暂无数据');
    }
}
    /**
 *  查询接口
 *@create_time  2024-01-24 14:07:18
 */ 
public function get_interface2($data = [], $user = [])
{
    $headLang  = request()->header('lang');
    $where = [];
  
    $order = 'freeinterface.aid desc';
	if (!empty($data['sort_field'])) {
		$order = 'freeinterface.'.$data['sort_field'].' '.$data['sort_type'];
	}

    $where[] = ['freeinterface.is_del', '=', 0]; 
 		if($user) {
 		$where[] = ['freeinterface.create_id', '=', $user['id'] ]; 
 		}
 
    $select_info = array (
); 
	$dataList = Db::table('lb_free_interface')
		->alias('freeinterface')
		->field("freeinterface.cheng")
		->where($where)
		->order($order)
		->select();

    if($dataList){
        return ApiReturn::r(1, $dataList, '请求成功');
    }else{
        return ApiReturn::r(1, [], '暂无数据');
    }
}
    /**
 *  查询接口
 *@create_time  2024-01-25 11:02:53
 */ 
public function get_interface123($data = [], $user = [])
{
    $headLang  = request()->header('lang');
    $where = [];
  
    $order = 'freeinterface.aid desc';
	if (!empty($data['sort_field'])) {
		$order = 'freeinterface.'.$data['sort_field'].' '.$data['sort_type'];
	}

    $where[] = ['freeinterface.is_del', '=', 0]; 
 
    $select_info = array (
  'xingbie' => 
  array (
    1 => '男',
    2 => '女',
    3 => '保密',
  ),
); 
	$dataList = Db::table('lb_free_interface')
		->alias('freeinterface')
		->leftjoin('lb_free_order freeorder', 'freeorder.aid = freeinterface.freeorder_id')
		->field("freeorder.code as freeorder_code,freeinterface.cheng,freeinterface.shengshiqu,freeinterface.touxiang,freeinterface.shipin,freeinterface.free_field_128868,freeinterface.free_field_128870,freeinterface.shengri,freeinterface.xingbie,freeinterface.aihao")
		->where($where)
		->order($order)
		->select();
	foreach ($dataList as &$infodataList){
		$area = \app\common\model\Area::where([["region_code", "in", $infodataList['shengshiqu']]])->column("name");
		if (count($area) > 0) {
			$infodataList['shengshiqu_area'] = implode(',', $area);
		}else{
			$infodataList['shengshiqu_area'] = '';
		}
			$infodataList['touxiang']  = get_file_url($infodataList['touxiang']);
			$infodataList['shipin']  = [get_file_url($infodataList['shipin'])];
			$infodataList['shengri'] = $infodataList['shengri'];
			$infodataList['xingbie_name'] = $select_info['xingbie']["{$infodataList['xingbie']}"] ?? '';
	}

    if($dataList){
        return ApiReturn::r(1, $dataList, '请求成功');
    }else{
        return ApiReturn::r(1, [], '暂无数据');
    }
}
    /**
 *  操作接口
 *@param  Array[数组]  userList  会员列表
 *@param  Array[数组]  vipList  员工列表
 *@create_time  2024-02-07 10:09:41
 */ 
public function set_interface($data = [], $user = [])
{
    $return_data = [];
    Db::startTrans();
    try {
        $table_name = 'lb_free_interface';
		//批量添加接口
		foreach($data['vipList'] as $key => $val) {
			$param=[];
			$param['update_time'] = time();
			$param['create_time'] = time();
			$param['create_id']= $user['id'];
			foreach($data['userList'] as $k => $v) {
				if ($k == $key) {
					$param['status'] = $v['status'];
				}
			}
			foreach($data['vipList'] as $k => $v) {
				if ($k == $key) {
					$param['sort'] = $v['sort'];
				}
			}
			foreach($data['userList'] as $k => $v) {
				if ($k == $key) {
					$param['cheng'] = $v['cheng'];
				}
			}
			$table = MemberCache::setTableInfoToCache(MemberID, 'lb_free_interface', 'table_name');
			$auto_code_data = system_auto_code_data($param, $table);
			$param['bianma'] = $auto_code_data['bianma'] ?? '';
			$param['is_del'] = 0;
			$param['member_id'] = (isset($user['member_id']))?$user['member_id']:0;
			$param['uid'] = (isset($user['aid']))?$user['aid']:0;
			Db::table($table_name)->insert($param);
		}

        
        

        Db::commit();
        
        
    }
    catch (\Exception $e){
        Db::rollback();
        $msg = $e->getMessage();
        $code = $e->getCode();
        return ApiReturn::r($code, [], $msg);
    }

    return ApiReturn::r(1, $return_data, '请求成功');
}
    /**
 *  查询接口
 *@create_time  2024-02-06 11:29:53
 */ 
public function get_interface111($data = [], $user = [])
{
    $headLang  = request()->header('lang');
    $where = [];
  
    $order = 'freeinterface.aid desc';
	if (!empty($data['sort_field'])) {
		$order = 'freeinterface.'.$data['sort_field'].' '.$data['sort_type'];
	}

    $where[] = ['freeinterface.is_del', '=', 0]; 
 		$where[] = ['freeinterface.create_time', '<', time()]; 
 
    $select_info = array (
  'xingbie' => 
  array (
    1 => '男',
    2 => '女',
    3 => '保密',
  ),
); 
	$dataList = Db::table('lb_free_interface')
		->alias('freeinterface')
		->leftjoin('lb_free_order freeorder', 'freeorder.aid = freeinterface.freeorder_id')
		->field("freeorder.code as freeorder_code,freeinterface.cheng,freeinterface.wenjianshangchuan,freeinterface.touxiang,freeinterface.shipin,freeinterface.free_field_128868,freeinterface.free_field_128870,freeinterface.shengri,freeinterface.xingbie,freeinterface.aihao")
		->where($where)
		->order($order)
		->select();
	foreach ($dataList as &$infodataList){
			$infodataList['wenjianshangchuan'] = get_pass_files_url($infodataList['wenjianshangchuan'],1);
			$infodataList['touxiang']  = get_file_url($infodataList['touxiang']);
			$infodataList['shipin']  = [get_file_url($infodataList['shipin'])];
			$infodataList['shengri'] = $infodataList['shengri'];
			$infodataList['xingbie_name'] = $select_info['xingbie']["{$infodataList['xingbie']}"] ?? '';
		$child_where = []; 
 		$child_where[] = ['freeyonghu.is_del', '=', 0]; 
 		$child_where[] = ['freeyonghu.aihao', '=', $infodataList['aihao']]; 
 		$childList = Db::table('lb_free_yonghu')
		->alias('freeyonghu')
		->leftjoin('lb_free_ceshianniu freeceshianniu', 'freeceshianniu.aid = freeyonghu.freeceshianniu_id')
		->leftjoin('lb_free_fenlei freefenlei', 'freefenlei.aid = freeyonghu.freefenlei_id')
		->field( 'freeyonghu.aid,freeyonghu.create_time,freeyonghu.status,freeyonghu.kaiguan,freeyonghu.bianhao,freeyonghu.dizhi,freeyonghu.tupian,freeyonghu.wenjian,freeyonghu.aihao,freeyonghu.shipin,freeyonghu.jujueyuanyin,freefenlei.fenlei as freefenlei_fenlei,freeyonghu.dantu,freeyonghu.yinpin,freeyonghu.xingbie,freeyonghu.shijian,freeyonghu.xitongyuangong,freeyonghu.yanse,freefenlei.yinpin as freefenlei_yinpin,freefenlei.shipin as freefenlei_shipin,freeyonghu.renyuanzhuangtai,freeyonghu.shouji,freeyonghu.xingge,freeyonghu.shuzi,freeyonghu.mima,freeyonghu.hebingziduan,freeyonghu.wenan,freeyonghu.pay_status,freeyonghu.pay_time,freeyonghu.jine,freeyonghu.duoxingwenben,freeyonghu.tupianduo,freeceshianniu.shengchengriqi as freeceshianniu_shengchengriqi,freeceshianniu.shixiaoriqi as freeceshianniu_shixiaoriqi,freeceshianniu.youxiaoqi as freeceshianniu_youxiaoqi,freeyonghu.free_field_121700,freeyonghu.tianqi,freeyonghu.xingming' )
		->where($child_where)
		->limit(0,$data['child_list_rows'])		->select();
$child_select_info = array (
  'xingbie' => 
  array (
    1 => '男',
    2 => '女',
    3 => '保密',
  ),
  'pay_status' => 
  array (
    6 => '超时未支付',
    5 => '退款失败',
    4 => '退款成功',
    3 => '等待退款',
    2 => '取消支付',
    1 => '支付成功',
    0 => '等待支付',
  ),
  'tianqi' => 
  array (
    1 => '晴天',
    2 => '阴天',
    3 => '多云',
  ),
); 
	foreach ($childList as &$infochildList){
			$infochildList['create_time'] = $infochildList['create_time']? date('Y-m-d', $infochildList['create_time']) : '';
			$infochildList['tupian'] = get_files_url($infochildList['tupian']);
			$infochildList['wenjian'] = get_pass_files_url($infochildList['wenjian'],1);
			$infochildList['shipin']  = [get_file_url($infochildList['shipin'])];
			$infochildList['dantu']  = get_file_url($infochildList['dantu']);
			$infochildList['yinpin']  = get_file_url($infochildList['yinpin']);
			$infochildList['xingbie_name'] = $child_select_info['xingbie']["{$infochildList['xingbie']}"] ?? '';
			$infochildList['shijian'] = $infochildList['shijian']? date('Y-m-d H:i:s', $infochildList['shijian']): '';
			$infochildList['xitongyuangong_name'] = $select_info['member_user']["{$infochildList['xitongyuangong']}"] ?? '';
			$infochildList['xingge'] = get_pass_files_url($infochildList['xingge'],1);
			$infochildList['pay_status_name'] = $child_select_info['pay_status']["{$infochildList['pay_status']}"] ?? '';
			$infochildList['pay_time'] = $infochildList['pay_time']? date('Y-m-d', $infochildList['pay_time']) : '';
			$infochildList['tupianduo'] = get_files_url($infochildList['tupianduo']);
			$infochildList['tianqi_name'] = $child_select_info['tianqi']["{$infochildList['tianqi']}"] ?? '';
	}
		$infodataList['aihao']  = $childList;
	}

    if($dataList){
        return ApiReturn::r(1, $dataList, '请求成功');
    }else{
        return ApiReturn::r(1, [], '暂无数据');
    }
}
    /**
 *  操作接口
 *@create_time  2024-02-06 16:21:49
 */ 
public function set_interface123($data = [], $user = [])
{
    $return_data = [];
    Db::startTrans();
    try {
        		//添加接口
		$param=[];
		$param['update_time'] = time();
		$param['create_time'] = time();
		$table = MemberCache::setTableInfoToCache(MemberID, 'lb_free_interface', 'table_name');
		$auto_code_data = system_auto_code_data($param, $table);
		p($auto_code_data);
		$param['bianma'] = $auto_code_data['bianma'] ?? '';
		$param['is_del'] = 0;
		$param['member_id'] = (isset($user['member_id']))?$user['member_id']:0;

		$query_0 = $param;
		$table_name = 'lb_free_interface';
		$primary_key = 'aid';
		$res = Db::table($table_name)->insertGetId($param);
		if ($res) {
			$query_0['aid'] = $res;
		}
		if (!($res)) {
			throw new \Exception('错误',-1);
		}


        
        

        Db::commit();
        
        
    }
    catch (\Exception $e){
        Db::rollback();
        $msg = $e->getMessage();
        $code = $e->getCode();
        return ApiReturn::r($code, [], $msg);
    }

    return ApiReturn::r(1, $return_data, '请求成功');
}
    /**
 *  查询接口
 *@param  String[字符串]  aid  ID
 *@create_time  2024-02-06 18:08:24
 */ 
public function get_interface_test($data = [], $user = [])
{
    $headLang  = request()->header('lang');
    $where = [];
  
    $order = 'freeinterface.aid desc';
	if (!empty($data['sort_field'])) {
		$order = 'freeinterface.'.$data['sort_field'].' '.$data['sort_type'];
	}

    $where[] = ['freeinterface.is_del', '=', 0]; 
 	if (!empty($data['aid'])) {
		$where[] = ['freeinterface.aid', '=', $data['aid']]; 
 	}

    $select_info = array (
  'xingbie' => 
  array (
    1 => '男',
    2 => '女',
    3 => '保密',
  ),
'member_user' => MemberCache::getUserListToMemberID(MemberID), 
'member_dept' => MemberCache::getDeptListToMemberID(MemberID), 
); 
	$dataList = Db::table('lb_free_interface')
		->alias('freeinterface')
		->leftjoin('lb_free_order freeorder', 'freeorder.aid = freeinterface.freeorder_id')
		->field("freeorder.code as freeorder_code,freeinterface.bianma,freeinterface.cheng,freeinterface.bumen,freeinterface.yuangong,freeinterface.wenjianshangchuan,freeinterface.touxiang,freeinterface.shipin,freeinterface.free_field_128868,freeinterface.free_field_128870,freeinterface.shengri,freeinterface.xingbie,freeinterface.aihao")
		->where($where)
		->order($order)
		->select();
	foreach ($dataList as &$infodataList){
			$infodataList['bumen_name'] = $select_info['member_dept']["{$infodataList['bumen']}"] ?? '';
			$infodataList['yuangong_name'] = $select_info['member_user']["{$infodataList['yuangong']}"] ?? '';
			$infodataList['wenjianshangchuan'] = get_pass_files_url($infodataList['wenjianshangchuan'],1);
			$infodataList['touxiang']  = get_file_url($infodataList['touxiang']);
			$infodataList['shipin']  = [get_file_url($infodataList['shipin'])];
			$infodataList['shengri'] = $infodataList['shengri'];
			$infodataList['xingbie_name'] = $select_info['xingbie']["{$infodataList['xingbie']}"] ?? '';
	}

    if($dataList){
        return ApiReturn::r(1, $dataList, '请求成功');
    }else{
        return ApiReturn::r(1, [], '暂无数据');
    }
}
    /**
 *  操作接口
 *@param  String[字符串]  create_time  创建时间
 *@create_time  2024-02-07 17:42:16
 */ 
public function set_interface12312($data = [], $user = [])
{
    $return_data = [];
 
     		//查询接口
		$order = 'freeinterface.create_time desc';
		$where = [];
		$where[] = ['freeinterface.is_del', '=', 0]; 
 		if (isset($data['create_time'])) {
		$time_arr = explode(' - ',$data['create_time']); 
 		$where[] = ['freeinterface.create_time', 'between time', $time_arr ]; 
 		}
		$query_0 = Db::table('lb_free_interface')
		->alias('freeinterface')
		->where($where)
		->order($order)
		->find();
		if (!($query_0)) {
			throw new \Exception('错误',-1);
		}

        
     
     
     

    return ApiReturn::r(1, $return_data, '请求成功');
}
    /**
 *  查询接口
 *@create_time  2024-03-07 11:29:03
 */ 
public function get_interface_list($data = [], $user = [])
{
    return ApiReturn::r(-1, '', '请求失败');
    $headLang  = request()->header('lang');
    $where = [];
  
    $order = 'freeinterface.aid desc';
$order = 'freeorder.aid desc';
	if (!empty($data['sort_field'])) {
		$order = 'freeinterface.'.$data['sort_field'].' '.$data['sort_type'];
	}

    $where[] = ['freeinterface.is_del', '=', 0]; 
 
    $select_info = array (
'member_user' => MemberCache::getUserListToMemberID(MemberID), 
'member_dept' => MemberCache::getDeptListToMemberID(MemberID), 
);
	$dataList = Db::table('lb_free_interface')
		->alias('freeinterface')
		->leftjoin('lb_free_order freeorder', 'freeorder.aid = freeinterface.freeorder_id')
		->field("freeorder.code as freeorder_code,freeinterface.bianma,freeinterface.cheng,freeinterface.bumen,freeinterface.yuangong")
		->where($where)
		->order($order)
		->select();
	foreach ($dataList as &$infodataList){
			$infodataList['bumen_name'] = $select_info['member_dept']["{$infodataList['bumen']}"] ?? '';
			if ($infodataList['yuangong'] != '') {
				$yuangong_val = '';
				$yuangong_arr = explode(',', $infodataList['yuangong']);
				foreach($yuangong_arr as $key => $val) {
					$yuangong_val .= $select_info['member_user']["{$val}"] . ','; 
				}
				$yuangong_val = rtrim($yuangong_val, ',');
			}
			$infodataList['yuangong_name'] = $yuangong_val ?? '';
	}

    if($dataList){
        return ApiReturn::r(1, $dataList, '请求成功');
    }else{
        return ApiReturn::r(1, [], '暂无数据');
    }
}
    /**
 *  操作接口
 *@param  String[字符串]  cheng  昵称
 *@create_time  2024-02-26 09:44:48
 */ 
public function set_interface111($data = [], $user = [])
{
    $return_data = [];
 
     		//入参判断接口
		if (!($data['cheng'] != '')) {
			throw new \Exception('错误',-1);
		}
		//查询接口
		$order = 'freeinterface.create_time desc';
		$where = [];
		$where[] = ['freeinterface.is_del', '=', 0]; 
 		if (isset($data['cheng'])) {
		$where[] = ['freeinterface.cheng', '=', $data['cheng']]; 
 		}
		$query_1 = Db::table('lb_free_interface')
		->alias('freeinterface')
		->where($where)
		->order($order)
		->find();
		if (!($query_1)) {
		//添加接口
		$param=[];
		$param['update_time'] = time();
		$param['create_time'] = time();
		$param['cheng']= $data['cheng'];
		$param['is_del'] = 0;
		$param['member_id'] = (isset($user['member_id']))?$user['member_id']:0;

		$query_2 = $param;
		$table_name = 'lb_free_interface';
		$primary_key = 'aid';
		$res = Db::table($table_name)->insertGetId($param);
		if ($res) {
			$query_2['aid'] = $res;
		}
		if (!($res)) {
			throw new \Exception('错误',-1);
		}

		}
		 else{
		//更新接口
		$where = [];
		$where[] = ['is_del', '=', 0]; 
 		if (isset($data['cheng'])) {
		$where[] = ['cheng', '=', $data['cheng']]; 
 		}
		$param=[];
		$param['cheng']= 666;
		$param['update_time'] = time();

		$query_3 = $param;
		$table_name = 'lb_free_interface';
		$primary_key = 'aid';
		$res = Db::table($table_name)->where($where)->update($param);
		if (!($res)) {
			throw new \Exception('错误',-1);
		}

		}

        
     
     
     

    return ApiReturn::r(1, $return_data, '请求成功');
}
                
/**
 *  操作接口
 *@param  String[字符串]  aid  ID
 *@param  String[字符串]  weixin  微信
 *@create_time  2024-03-23 11:43:48
 */ 
public function add_interface($data = [], $user = [])
{
    $return_data = [];
    Db::startTrans();
    try {
        		//更新接口
		$where = [];
		$where[] = ['is_del', '=', 0]; 
 		if (isset($data['aid'])) {
		$where[] = ['aid', '=', $data['aid']]; 
 		}
		$param=[];
		$param['weixin']= $data['weixin'];
		$param['lianjie']= $data[''];
		$param['update_time'] = time();

		$table_name = 'lb_free_interface';
		$old_data = Db::table($table_name)->where($where)->find();
		if ($old_data) {
			$param['aid'] = $old_data['aid'] ?? 0;
		}
		config('before_update_data', $old_data);
		$query_0 = $param;
		$primary_key = 'aid';
		$res = Db::table($table_name)->where($where)->update($param);
		if (!($res)) {
			throw new \Exception('错误',-1);
		}

		//添加接口
		$param=[];
		$param['update_time'] = time();
		$param['create_time'] = time();
		$table = MemberCache::setTableInfoToCache(MemberID, 'lb_free_interface', 'table_name');
		$auto_code_data = system_auto_code_data($param, $table);
		$param['bianma'] = $auto_code_data['bianma'] ?? '';
		$param['weixin']= $data['weixin'];
		$param['is_del'] = 0;
		$param['member_id'] = (isset($user['member_id']))?$user['member_id']:0;

		$query_1 = $param;
		$table_name = 'lb_free_interface';
		$primary_key = 'aid';
		$res = Db::table($table_name)->insertGetId($param);
		if ($res) {
			$query_1['aid'] = $res;
		}
		if (!($res)) {
			throw new \Exception('错误',-1);
		}


        
        

        Db::commit();
        
        		$aid = $query_0['aid'];
		\app\spread\server\Message::sendMsg($aid, 'lb_free_interface','2979');

    }
    catch (\Exception $e){
        Db::rollback();
        $msg = $e->getMessage();
        $code = $e->getCode();
        return ApiReturn::r($code, [], $msg);
    }

    return ApiReturn::r(1, $return_data, '请求成功');
}
            
/**
 *  查询接口
 *@create_time  2024-03-23 14:47:42
 */ 
public function get_interface_lx($data = [], $user = [])
{
    $headLang  = request()->header('lang');
    $where = [];
  
    $order = 'freeinterface.aid desc';
	if (!empty($data['sort_field'])) {
		$order = 'freeinterface.'.$data['sort_field'].' '.$data['sort_type'];
	}

    $where[] = ['freeinterface.is_del', '=', 0]; 
 
    $select_info = array (
  'xuanxiang' => 
  array (
    1 => '一',
    2 => '二',
    3 => '三',
    4 => '四',
    5 => '五',
  ),
  'xingbie' => 
  array (
    1 => '男',
    2 => '女',
    3 => '保密',
  ),
'member_user' => MemberCache::getUserListToMemberID(MemberID), 
'member_dept' => MemberCache::getDeptListToMemberID(MemberID), 
); 
	$dataList = Db::table('lb_free_interface')
		->alias('freeinterface')
		->leftjoin('lb_free_form_ freeform', 'freeform.aid = freeinterface.freeform_id')
		->field("freeinterface.aid,freeinterface.xitongyuangong,freeinterface.lianjie,freeinterface.bianma,freeinterface.weixin,freeinterface.shengshiqu,freeform.gongsimingcheng as freeform_gongsimingcheng,freeinterface.qiankuanjine,freeinterface.xuanxiang,freeinterface.cheng,freeinterface.shoujihao,freeinterface.bumen,freeinterface.yuangong,freeinterface.dituxuandian,freeinterface.wenjianshangchuan,freeinterface.touxiang,freeinterface.shipin,freeinterface.free_field_128868,freeinterface.free_field_128870,freeinterface.shengri,freeinterface.xingbie,freeinterface.aihao,freeinterface.create_time,freeinterface.status")
		->where($where)
		->order($order)
		->select();
	foreach ($dataList as &$infodataList){
			$infodataList['xitongyuangong_name'] = $select_info['member_user']["{$infodataList['xitongyuangong']}"] ?? '';
		$area = \app\common\model\Area::where([["region_code", "in", $infodataList['shengshiqu']]])->column("name");
		if (count($area) > 0) {
			$infodataList['shengshiqu_area'] = implode(',', $area);
		}else{
			$infodataList['shengshiqu_area'] = '';
		}
			$infodataList['xuanxiang_name'] = $select_info['xuanxiang']["{$infodataList['xuanxiang']}"] ?? '';
			$infodataList['bumen_name'] = $select_info['member_dept']["{$infodataList['bumen']}"] ?? '';
			if ($infodataList['yuangong'] != '') {
				$yuangong_val = '';
				$yuangong_arr = explode(',', $infodataList['yuangong']);
				foreach($yuangong_arr as $key => $val) {
					$yuangong_val .= $select_info['member_user']["{$val}"] . ','; 
				}
				$yuangong_val = rtrim($yuangong_val, ',');
			}
			$infodataList['yuangong_name'] = $yuangong_val ?? '';
			$infodataList['wenjianshangchuan'] = get_pass_files_url($infodataList['wenjianshangchuan'],1);
			$infodataList['touxiang']  = get_file_url($infodataList['touxiang']);
			$infodataList['shipin']  = [get_file_url($infodataList['shipin'])];
			$infodataList['shengri'] = $infodataList['shengri'];
			$infodataList['xingbie_name'] = $select_info['xingbie']["{$infodataList['xingbie']}"] ?? '';
			$infodataList['create_time'] = $infodataList['create_time'];
	}

    if($dataList){
        return ApiReturn::r(1, $dataList, '请求成功');
    }else{
        return ApiReturn::r(1, [], '暂无数据');
    }
}
                
/**
 *  操作接口
 *@create_time  2024-03-27 16:57:50
 */ 
public function set_interface0327($data = [], $user = [])
{
    $return_data = [];
 
     		//查询接口
		$order = 'freeinterface.create_time desc';
		$where = [];
		$where[] = ['freeinterface.is_del', '=', 0]; 
 		if (isset($data[''])) {
		$where[] = ['freeinterface.shengri', '=', $data['']]; 
 		}
		if (isset($data[''])) {
		$where[] = ['freeinterface.yuangong', '=', $data['']]; 
 		}
		if (isset($data[''])) {
		$where[] = ['freeinterface.bumen', '=', $data['']]; 
 		}
		$query_0 = Db::table('lb_free_interface')
		->alias('freeinterface')
		->where($where)
		->order($order)
		->find();
		if (!($query_0)) {
			throw new \Exception('错误',-1);
		}

        
     
     
     

    return ApiReturn::r(1, $return_data, '请求成功');
}
            
/**
 *  查询接口
 *@param  String[字符串]  aid  ID
 *@create_time  2024-03-28 17:05:53
 */ 
public function get_interface120328($data = [], $user = [])
{
    $headLang  = request()->header('lang');
    $where = [];
  
    $order = 'freeinterface.aid desc';
	if (!empty($data['sort_field'])) {
		$order = 'freeinterface.'.$data['sort_field'].' '.$data['sort_type'];
	}

    $where[] = ['freeinterface.is_del', '=', 0]; 
 	if (!empty($data['aid'])) {
		$where[] = ['freeinterface.aid', '=', $data['aid']]; 
 	}

    $select_info = array (
); 
	$dataList = Db::table('lb_free_interface')
		->alias('freeinterface')
		->field("freeinterface.duotu")
		->where($where)
		->order($order)
		->select();
	foreach ($dataList as &$infodataList){
			$infodataList['duotu'] = get_files_url($infodataList['duotu']);
	}

    if($dataList){
        return ApiReturn::r(1, $dataList, '请求成功');
    }else{
        return ApiReturn::r(1, [], '暂无数据');
    }
}

}